/*
 * @Descripttion: 说明
 * @Author: ZXS
 * @Date: 2022-09-09 14:36:49
 * @LastEditors: ZXS
 * @LastEditTime: 2022-09-13 15:07:46
 */
import Cookies from 'js-cookie'

const TokenKey = 'vue_admin_template_token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function setRoles(role_key) {
  const roles = []
  roles.push(role_key)
  const value = JSON.stringify(roles)
  return Cookies.set('role_key', value)
}

export function getRoles() {
  const roles = Cookies.get('role_key')
  return JSON.parse(roles || null)
}

export function removeRoles() {
  return Cookies.remove('role_key')
}
